home *** CD-ROM | disk | FTP | other *** search
- #include <exec/exec.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <clib/exec_protos.h>
- struct User {
- char Name[31],Pass[9],Location[30],PhoneNumber[13];
- USHORT Slot_Number;
- USHORT Sec_Status,
- Sec_Board, /* File or Byte Ratio */
- Sec_Library, /* Ratio */
- Sec_Bulletin, /* Computer Type */
- Messages_Posted;
- /* Note ConfYM = the last msg you actually read, ConfRead is the same ?? */
- ULONG NewSinceDate, ConfRead[9];
- char Conference_Access[10];
- USHORT Uploads, Downloads, ConfRJoin, Times_Called;
- long Time_Last_On, Time_Used, Time_Limit, Time_Total;
- ULONG Bytes_Download, Bytes_Upload, Daily_Bytes_Limit, Daily_Bytes_Dld;
- char Expert;
- ULONG ConfYM[9];
- long BeginLogCall;
- UBYTE Protocol, UUCPA, LineLength, New_User;
- };
- char BBSLocal[200];
- char UserData[200];
- char AreaList[200];
- char AreaBuffer[200];
- void GetArea(char *s,char *f);
- void sr(char *s);
- main(int argc,char *argv[])
- {
- FILE *fi,*fo,*fo2;
- struct User u;
- int Areas=FALSE;
- int i;
- if(argc<2)
- {
- printf("ConvertDB version 1.1 written by Joseph Hodge\n");
- printf("Usage: ConvertDB <UserData location> <AreaList>\n");
- printf(" ie: ConvertDB BBS:User.Data\n");
- printf(" ie: ConvertDB BBS:User.Data bbs:AreaList\n");
-
- printf("\n");
- exit(0);
- }
- if(argc==3) { strcpy(AreaList,argv[2]); sr(AreaList); Areas=TRUE; }
-
- strcpy(BBSLocal,argv[1]);
- sr(BBSLocal);
- if(!Areas) { strcpy(AreaList,BBSLocal); strcat(AreaList,".Lst"); }
- strcpy(UserData,BBSLocal);
- strcat(UserData,".new");
- fi=fopen(BBSLocal,"rb");
-
- if(fi==NULL)
- {
- printf("Error, can't locate user.data\n");
- exit(0);
- }
- fo=fopen(UserData,"wb");
- if(!Areas) fo2=fopen(AreaList,"w");
- while(fread((APTR)&u,sizeof(struct User),1,fi)!=NULL)
- {
- if(!Areas) fprintf(fo2,"%-9.9s= \n",u.Conference_Access);
- else
- {
- GetArea(u.Conference_Access,AreaList);
- strcpy(u.Conference_Access,AreaBuffer);
- fwrite((APTR)&u,sizeof(struct User),1,fo);
- }
- }
- if(!Areas) fclose(fo2);
- fclose(fo);
- fclose(fi);
-
- }
- void GetArea(char *s,char *f)
- {
- FILE *fi;
- char temp[100];
- fi=fopen(f,"r");
- if(fi==NULL) strcpy(AreaBuffer,"Standard");
- while(fgets(temp,80,fi)!=NULL)
- {
- sr(temp);
- if(!strnicmp(temp,s,9))
- {
- strcpy(AreaBuffer,&temp[11]);
- fclose(fi);
- return;
- }
- }
- fclose(fi);
- strcpy(AreaBuffer,"Standard");
- }
- void sr(char *s)
- {
- register int i;
- i=strlen(s)-1;
- while(i>-1)
- {
- if(*(s+i)<=32) *(s+i)='\0'; else break;
- i--;
- }
- }
-